const render = () => {
    const hash = window.location.hash || '#page2'
    const mainElement = document.querySelector('#container')
    mainElement.innerHTML = ''
    if (hash === '#page2') {
        import(/* webpackChunkName: 'page2' */'./page2.js').then(({ default: page1 }) => {
            mainElement.appendChild(page1())
        })
    } else {
        import('./page1.js').then(({ default: page2 }) => {
            mainElement.appendChild(page2())
        })
    }
}

render()
window.addEventListener('hashchange', render)
